package handle

import (
	"wths/wthsjy-im/protocol/protocolpb"
)

// MessageHandle 消息体实现
type MessageHandle interface {
	Connect(connect *protocolpb.Connect) (clientId string, pass bool)
	Disconnect(clientId string, info *protocolpb.DisConnect)
	Ping(clientId string, info *protocolpb.Ping)
	Publish(clientId string, info *protocolpb.Publish)
	Subscribe(clientId string, info *protocolpb.Subscribe) map[string]bool
	UnSubscribe(clientId string, info *protocolpb.Unsubscribe) map[string]bool
}

// TopicHandle topic 绑定/解绑实现
type TopicHandle interface {
	Bind(topicName string, cli ClientHandle)
	Unbind(topicName string, cli ClientHandle)
	PushMessageToTopic(topicName string, data []byte)
}

// ClientHandle 客户端链接实现
type ClientHandle interface {
	ClientID() string
	Write(b []byte) error
	Close()
	Closed() bool
}
